#ifndef POPUP_USERS_TABLE_MODEL_H
#define POPUP_USERS_TABLE_MODEL_H

#include <QtGui>
#include <PopupLibTypes.hpp>
#include <PopupUsersManager.hpp>

struct PopupUsersTableModel : public QStandardItemModel
{
  Q_OBJECT

public:
  PopupUsersTableModel();
  virtual ~PopupUsersTableModel() {}
  virtual Qt::ItemFlags flags (const QModelIndex &) const;
  
  void selectUsers(QItemSelection & p_selection,
                   const Popup::UserList & p_users);

  void updateUser(const Popup::User *p_user,
                  unsigned short p_updateMask,
                  bool p_isNewUser);

  void updateUserStatistics(const PopupUserExt *p_user,
                            unsigned short p_updateMask);

  void removeAll();

private:

  const QBrush & selectBrush(const Popup::User *p_user);

  QBrush m_openBrush;
  QBrush m_promptBrush;
  QBrush m_txtOnlyBrush;
  QBrush m_muteBrush;
  QBrush m_deadBrush;
};

#endif // POPUP_USERS_TABLE_MODEL_H
